package edu.wust;

import java.io.*;

public class exam22 {

    public static void range(String[] arr){
        int n=arr.length-1;
        for(int i=0;i<n;i++){
            for(int j=0;j<n-i;j++){
                if(arr[j].compareTo(arr[j+1])>0){
                    swap(arr,j,j+1);
                }
            }
        }
    }
    public static void swap(String[] n,int x,int y){
        String temp=n[y];
        n[y]=n[x];
        n[x]=temp;
    }
    public static void main(String[] args) throws IOException {
        File f=new File("E:\\大学作业\\JAVA俱乐部\\作业题目\\p022-names.txt");
        FileReader fr=new FileReader(f);
        BufferedReader br=new BufferedReader(fr);
        String[]s=br.readLine().split(",");
        range(s);
        long sum=0,n=s.length;
        for(int i=0;i<n;i++){
            int temp=0;
            int nn=s[i].length();
            for(int j=0;j<nn;j++){
                if(s[i].charAt(j)!='"')
                temp+=s[i].charAt(j)-'A'+1;
            }
            temp*=(i+1);
            sum+=temp;
        }
        System.out.println(sum);
    }
}

